using System;

namespace Source.Common
{
    [Serializable]
    public class Visit
    {
        public string Username { get; private set; }
        public Guid Token { get; private set; }
        public UserDto User { get; private set; }

        public Visit(Guid token, IUser user) : this(token, user, null) { }

        public Visit(Guid token, IUser user, string username)
        {
            Token = token;
            if (user != null)
            {
                User = new UserDto
                           {
                               UserId = user.UserId,
                               DateFormat = user.DateFormat,
                               DefaultCurrencyId = user.DefaultCurrencyId,
                               Email = user.Email,
                               FirstName = user.FirstName,
                               LastName = user.LastName,
                               Upi = user.Upi,
                           };
            }
            Username = username;
        }
    }
}